import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import RoutesPermission from './routesPermission';

Vue.use(VueRouter)

export default Promise.all(routes).then(routes => {
    const router = new VueRouter({
        mode: 'hash',
        base: process.env.BASE_URL,
        routes
    })

    /**
       * 路由重定向
       */
    RoutesPermission.redirectRoutes(router);

    /**
      * 加载样式
      */
    RoutesPermission.loadStyle(router);

    return router
})